// 获取token并解析
import { jwtDecode } from 'jwt-decode'
function decodeJwtToken() {
  const token = localStorage.getItem('token')
  if (token) {
    try {
      return jwtDecode(token)
    } catch (error) {
      console.error('Error decoding JWT token:', error)
      return null
    }
  } else {
    console.error('Token not found in localStorage')
    return null
  }
}

// 调用函数
export default decodeJwtToken
